﻿namespace _02.BankExersice
{
    using System;
    using _02.BankExersice.Accounts;
    using _02.BankExersice.Customers;

    public class BankExersice
    {
        public static void Main()
        {
            Account[] bankAccounts = {
                                     new Deposit(new IndividualCustomer("Marin Petrov","8011111515", "+359893888999"), 0.4m, 7000m),
                                     new Loan(new CompanyCustomer("Dris Inc.", "4545648648", "+359895123456"), 0.98m, 15000m),
                                     new Mortage(new IndividualCustomer("Moran Moravich", "7405051498", "+359879789789"), 1m, 600m)
                                     };
            PrintAllAccounts(bankAccounts, 25);
            Console.WriteLine();

            foreach (var account in bankAccounts)
            {
                account.Deposit(666);
            }
            PrintAllAccounts(bankAccounts, 25);
            Console.WriteLine();

            Deposit[] depositAccounts = {
                                        new Deposit(new IndividualCustomer("Pencho Gyaurov", "1234567890", "16462174"), 1m, 1000m),
                                        new Deposit(new IndividualCustomer("Baba Yovka", "1234567890", "4678616"), 0.4m, 2000m),
                                        new Deposit(new IndividualCustomer("Dqdo Mincho", "1234567890", "876817617"), 0.1m, 3000m),
                                        };
            foreach (IWithDrawable deposit in depositAccounts)
            {
                deposit.WithDraw(100);
            }
             PrintAllAccounts(bankAccounts, 25);
        }

        private static void PrintAllAccounts(Account[] bankAccounts, int numberOfMonths)
        {
            foreach (var account in bankAccounts)
            {
                Console.WriteLine(account + ", Interest Amount for {0} months: {1}", numberOfMonths, account.CalculateInterestAmount(numberOfMonths));
            }
        }
    }
}